package com.hzx.demo.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.hzx.demo.R;
import com.hzx.demo.helper.ErrorReporter;
import com.hzx.demo.util.Entry;
import com.hzx.demo.util.HZXLog;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;

/**
 * Created by ke on 16-5-18.
 */
@Entry(desc = "用于测试自己学自acra中关于异常的捕获与处理", createTime = "2016-06-18 22:53")
@EActivity(R.layout.activity_acra_test)
public class AcraActivity extends AppCompatActivity{
    @SuppressWarnings("unused")
    private static final String TAG = "AcraActivity";

    private ErrorReporter mErrorReporter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mErrorReporter = new ErrorReporter(this);
    }

    @Click(R.id.btn_throw_exception)
    protected void onThrowException(){
        HZXLog.v(TAG, "onThrowException");
        new Thread(){
            @Override
            public void run() {
                HZXLog.v(TAG, "in a thread");
                throw new IllegalStateException("这是一个测试用的异常");
            }
        }.start();
    }
}
